import {
  Swipe,
  SwipeItem,
  Lazyload,
  Badge,
  Sidebar,
  SidebarItem,
  Collapse,
  CollapseItem,
  Tab,
  Tabs,
  Card,
  Image as VanImage,
  Button,
  Tag,
  Form,
  Field,
  ActionBar,
  ActionBarIcon,
  ActionBarButton,
  Checkbox,
  CheckboxGroup,
  SwipeCell,
  SubmitBar,
  Stepper,
  Icon,
  CellGroup,
  Cell,
  AddressEdit,
  AddressList,
  Loading,
  ContactCard,
  Dialog,
  ActionSheet,
  Grid,
  GridItem,
  List,
  PullRefresh
} from 'vant'
export default {
  install(app) {
    const components = [
      Lazyload,
      Swipe,
      SwipeItem,
      Badge,
      Sidebar,
      SidebarItem,
      Collapse,
      CollapseItem,
      Tab,
      Tabs,
      Card,
      VanImage,
      Button,
      Tag,
      Form,
      Field,
      ActionBar,
      ActionBarIcon,
      ActionBarButton,
      Checkbox,
      CheckboxGroup,
      SwipeCell,
      SubmitBar,
      Stepper,
      Icon,
      CellGroup,
      Cell,
      AddressEdit,
      AddressList,
      Loading,
      ContactCard,
      Dialog,
      ActionSheet,
      Grid,
      GridItem,
      List,
      PullRefresh
    ]
    components.forEach(c => {
      if (c === Lazyload) {
        app.use(c, {
          lazyComponent: true,
          loading: require('assets/images/icon/loading.gif'),
          error: require('assets/images/icon/loading.gif')
        })
      } else {
        app.use(c)
      }
    })
  }
}
